import { getCrudApi } from '@/utils/http/crud.ts'
import { ModelDto } from '@/api/model.ts'
import { GroupDto } from '@/api/group.ts'
import { SizeDto } from '@/api/size.ts'
import { request } from '@/utils/http'
import { ProcessDto } from '@/api/process.ts'

export interface StyleDto {
  id?: string
  modelId: string | null
  model: ModelDto
  groupId: string | null
  group: GroupDto
  sizes: SizeDto[]
}

export interface StyleSizeDto {
  sizeId: string
  amount: number
  check?: boolean
}

export interface CreateStyleDto {
  id?: string
  modelId: string | null
  groupId: string | null
  sizes: StyleSizeDto[]
  amount: number
  description: string | null
}

export default {
  ...getCrudApi<StyleDto>('style'),
}

export function createStyleProcess(id: string, process: ProcessDto[]) {
  return request.post(`/style/${id}/process`, {
    process,
  })
}
